<?php defined('_JEXEC') or die('Restricted access'); ?>

<form class="camps" action="index.php" method="post" name="adminSearch" id="adminSearch">
	<input type="hidden" name="Search"  value="" />
	<input class="submitbtn" type="submit" value="Reset">
	<input type="hidden" name="option" value="com_summercamps" />
	<input type="hidden" name="isreset" value="true"/>
	<input type="hidden" name="task" value="" />
</form>  <form class="camps" action="index.php" method="post" name="adminSearch" id="adminSearch">
	<input class="fulltext large" type="text" name="Search" id="Search" 
				size="32" maxlength="256" value="" />
	<input class="submitbtn" type="submit" value="Search">
	<input type="hidden" name="option" value="com_summercamps" />
	<input type="hidden" name="issearch" value="true"/>
	<input type="hidden" name="task" value="" />
	<!-- <input type="hidden" name="controller" value="camp" />  DEFAULT -->
</form>

<br>

<?php 
//print out what the user has just searched for if they HAVE searched. 
if($this->search)
	echo "<p>Results for search containing '<strong>".$this->search."</strong>'</p>";
?>

<br>
<form action="index.php" method="post" name="adminForm">
<div id="editcell">
    <table class="campslist">
    <thead>
        <tr>
            <th width="5">
                <?php echo JText::_( 'ID' ); ?>
            </th>
            <th width="20">
              <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
            </th>
            <th><?php echo JText::_( 'CampName' ); ?></th>
            <th><?php echo JText::_( 'Approved?' ); ?></th>
            <th><?php echo JText::_( 'Region' ); ?></th>
            <th><?php echo JText::_( 'City' ); ?></th>
            <th><?php echo JText::_( 'StartDate' ); ?></th>
            <th><?php echo JText::_( 'EndDate' ); ?></th>
            <th><?php echo JText::_( 'ContactName' ); ?></th>
            <th><?php echo JText::_( 'Email' ); ?></th>
            <th><?php echo JText::_( 'Website' ); ?></th>
            <th><?php echo JText::_( 'Phone' ); ?></th>
        </tr>
    </thead>
    <?php
    $k = 0;//
    
    /*We are able to access $this->items[$i] because in this view's
     * view.html.php, we had the lines:
     * 		// Gets the data(reference) from the model
     * 		$items =& $this->get( 'Data');
     * 		//Sticks the data(reference) into an items variable that is passed to the template (this file)
     * 		$this->assignRef( 'items', $items ); 
     */
    for ($i=0, $n=count( $this->items ); $i < $n; $i++)
    {
        $row =& $this->items[$i];
        $checked    = JHTML::_( 'grid.id', $i, $row->ID );
        $link = JRoute::_( 'index.php?option=com_summercamps&controller=camp&task=edit&cid[]='. $row->ID );
 
        ?>
	<tr class="<?php if($row->Approved) echo "approved"; else echo "notapproved"; ?>">
	<td><?php echo $row->ID; ?>				</td>
	<td><?php echo $checked; ?>				</td>
	<td><a href="<?php echo $link; ?>"><?php echo $row->CampName; ?></a></td>
	<td><?php if($row->Approved) echo "Yes"; else echo "No"; ?>		</td>
	<td><?php echo $row->Region; ?>			</td>
	<td><?php echo $row->City; ?>			</td>
	<td><?php echo $row->StartDate; ?>		</td>
	<td><?php echo $row->EndDate; ?>		</td>
	<td><?php echo $row->ContactName; ?>	</td>
	<td><?php echo $row->Email; ?>			</td>
	<td><?php echo $row->Website; ?>		</td>
	<td><?php echo $row->Phone; ?>			</td>

</tr>
<?php
$k = 1 - $k;//k alternates between 1 and 0 to give odd/even rows
}
?>
</table>
</div>
 
<input type="hidden" name="option" value="com_summercamps" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="controller" value="camp" />
 
</form>